package 盛最多水的容器;

public class Solution {
    public int maxArea(int[] height) {
        //定义指针
        int left = 0;
        int right = height.length - 1;
        int res = 0;
        while (left < right) {
            int min = Math.min(height[left], height[right]);
            int maxArea = min * (right - left);
            if (res < maxArea)
                res = maxArea;
            if (min == height[left])
                left++;
            else if (min == height[right])
                right--;
        }
        return res;
    }
}
